<template>
  <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
    <el-form-item label="角色名称" prop="name">
      <el-input
        v-model="queryParams.name"
        placeholder="请输入角色名称"
        clearable
        style="width: 240px"
        @keyup.enter.native="handleQuery" />
    </el-form-item>
    <el-form-item label="权限字符" prop="code">
      <el-input
        v-model="queryParams.code"
        placeholder="请输入权限字符"
        clearable
        style="width: 240px"
        @keyup.enter.native="handleQuery" />
    </el-form-item>
    <el-form-item label="状态" prop="status">
      <el-select v-model="queryParams.status" placeholder="角色状态" clearable style="width: 240px">
        <el-option
          v-for="dict in dict.type.sys_normal_disable"
          :key="dict.value"
          :label="dict.label"
          :value="dict.value" />
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
      <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  name: 'searchForm',
  dicts: ['sys_normal_disable'],
  props: {
    model: {
      type: Object,
      default() {
        return {}
      },
    },
  },
  data() {
    return {
      queryParams: {
        name: undefined,
        code: undefined,
        status: undefined,
      },
    }
  },
  methods: {
    handleQuery() {
      this.$emit('handleQuery', this.queryParams)
    },
    resetQuery() {
      this.resetForm('queryForm')
      this.$emit('resetQuery', this.queryParams)
    },
  },
}
</script>

<style scoped></style>
